package org.esk.dablog;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.apache.commons.lang.StringUtils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * This class
 * User: jc
 * Date: 24.11.2006
 * Time: 12:30:24
 * $Id:$
 */
public class ApplicationConstants {
    private static ApplicationConstants INSTANCE = null;


    public static ApplicationConstants getInstance() {
        return INSTANCE;
    }

    public static void setInstance (ApplicationConstants INSTANCE) {
        ApplicationConstants.INSTANCE = INSTANCE;
    }


    /**
     * system-wide defined date format
     */
    private SimpleDateFormat systemDateFormat;

    /**
     * path to images in the system
     */
    private String pathToImages;

    /**
     * entry preview length in bytes
     */
    private int previewLength;

    /**
     * max comment length in bytes
     */
    private int commentLength;


    /**
     * number of entries to show on one page
     */
    private int defaultPortion;


    public int getCommentLength() {
        return commentLength;
    }

    public void setCommentLength(int commentLength) {
        this.commentLength = commentLength;
    }

    public SimpleDateFormat getSystemDateFormat() {
        return systemDateFormat;
    }


    public void setSystemDateFormat(SimpleDateFormat systemDateFormat) {
        this.systemDateFormat = systemDateFormat;
    }


    public String getSystemDateFormatString() {
        return getSystemDateFormat() != null ? getSystemDateFormat().toPattern() : "";
    }

    public void setSystemDateFormatString(String systemDateFormatString) {
        this.systemDateFormat = new SimpleDateFormat(systemDateFormatString);
    }

    public String getPathToImages() {
        return pathToImages;
    }

    public void setPathToImages(String pathToImages) {
        this.pathToImages = pathToImages;
    }

    public int getPreviewLength() {
        return previewLength;
    }


    public void setPreviewLength(int previewLength) {
        this.previewLength = previewLength;
    }


    public int getDefaultPortion() {
        return defaultPortion;
    }

    public void setDefaultPortion(int defaultPortion) {
        this.defaultPortion = defaultPortion;
    }
}

